<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <legend>邮件设置</legend>
            <div>
                <form class="layui-form layui-form-pane" lay-filter="emailset">
                    <div class="layui-form-item">
                        <label class="layui-form-label">发件人姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" autocomplete="off" placeholder="请输入发件人姓名"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTP地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp" autocomplete="off" placeholder="请输入SMTP地址"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTP端口</label>
                        <div class="layui-input-block">
                            <input type="text" name="port" lay-verify="title" autocomplete="off" placeholder="请输入SMTP端口"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱账号</label>
                        <div class="layui-input-block">
                            <input type="text" name="emailname" lay-verify="title" autocomplete="off"
                                placeholder="请输入邮箱账号" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="password" lay-verify="title" autocomplete="off"
                                placeholder="请输入邮箱密码（授权码）" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">注册通知</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="regmsg" lay-skin="switch" lay-text="开启|关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">注册验证码</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="regcode" lay-skin="switch" lay-text="开启|关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">留言通知</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="saymsg" lay-skin="switch" lay-text="开启|关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="emailset">保存</button>
                    </div>

                </form>
            </div>
        </fieldset>
    </div>


</div>

<script>
    layui.use(['form', 'lycms'], function () {
        var form = layui.form
            , layer = layui.layer
            , lycms = layui.lycms;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //监听提交
        form.on('submit(emailset)', function (data) {
            lycms.emailOperate(data);
            return false;
        });

        // 页面初始化
        $(document).ready(function () {
            //获取初始信息
            $.post("/v1/admin/data/emailset", function (data, status) {
                //表单初始赋值
                form.val('emailset', data);
            });
        });
    });
</script>